<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: loader.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_12cda917fe1d7c8b4e7d2501bb3636e4.html">sdk</a></li><li class="navelem"><a class="el" href="dir_2f23e30b638d6a5f333babd9a5d183e1.html">include</a></li><li class="navelem"><a class="el" href="dir_d5ace589187da7c83c1a7507ec9fbbef.html">sifteo</a></li><li class="navelem"><a class="el" href="dir_9f7c4e3b7feb35fe458a50f9a0128960.html">asset</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">loader.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * This file is part of the public interface to the Sifteo SDK.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright &lt;c&gt; 2012 Sifteo, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifdef NOT_USERSPACE</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#   error This is a userspace-only header, not allowed by the current build.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;sifteo/asset/group.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;sifteo/math.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;sifteo/array.h&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;sifteo/abi.h&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keyword">namespace </span>Sifteo {</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">class </span>Volume;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html">   33</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html" title="One node in an AssetConfiguration list.">AssetConfigurationNode</a> {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    _SYSAssetConfiguration sys;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">     * @brief Initialize this node with an AssetSlot and AssetGroup</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">     * This initializes the AssetConfigurationNode with instructions for</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">     * the AssetLoader to make sure the AssetGroup &#39;group&#39; is available in the AssetSlot</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">     * &#39;slot&#39; by the time the load finishes.</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">     * If the AssetGroup is part of a different Volume, you must provide that volume</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">     * handle as the &#39;volume&#39; parameter, and the &#39;group&#39; must be mapped via MappedVolume.</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">     * If you are loading assets packaged with your own game, you do not need to provide</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">     * a volume.</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keywordtype">void</span> init(_SYSAssetSlot <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a0efc1f1c8f0ade9cdf7e2ca79d074415" title="Return the AssetSlot this node will be loaded into.">slot</a>, <a class="code" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> &amp;<a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a312615f5bd64cedf703c19e61e3e561a" title="Return the AssetGroup referenced by this node.">group</a>, _SYSVolumeHandle <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a51dd3414b0bc5cfcb9e293aa7c893e9e" title="Return the Volume handle referenced by this node.">volume</a> = 0)</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    {</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        sys.pGroup = <span class="keyword">reinterpret_cast&lt;</span>uintptr_t<span class="keyword">&gt;</span>(&amp;<a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a312615f5bd64cedf703c19e61e3e561a" title="Return the AssetGroup referenced by this node.">group</a>);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        sys.volume = <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a51dd3414b0bc5cfcb9e293aa7c893e9e" title="Return the Volume handle referenced by this node.">volume</a>;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        sys.dataSize = group.<a class="code" href="struct_sifteo_1_1_asset_group.html#a578e54dac23b6f52c909f75421d80df0" title="Get the compressed size of this asset group, in bytes.">compressedSize</a>();</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        sys.numTiles = group.<a class="code" href="struct_sifteo_1_1_asset_group.html#a7c86f2c89aa78e8857ce0b3c12d2d491" title="Get the size of this asset group, in tiles.">numTiles</a>();</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        sys.ordinal = group.<a class="code" href="struct_sifteo_1_1_asset_group.html#ace586bf9d043a3c2b8fcd930e1cf9c9e" title="Get a pointer to the read-only system data for this asset group.">sysHeader</a>()-&gt;ordinal;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        sys.slot = <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a0efc1f1c8f0ade9cdf7e2ca79d074415" title="Return the AssetSlot this node will be loaded into.">slot</a>;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    }</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a0efc1f1c8f0ade9cdf7e2ca79d074415">   61</a></span>&#160;    <a class="code" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a> <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a0efc1f1c8f0ade9cdf7e2ca79d074415" title="Return the AssetSlot this node will be loaded into.">slot</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_sifteo_1_1_asset_slot.html" title="AssetSlots are numbered containers, in a cube&#39;s flash memory, which can hold AssetGroups.">AssetSlot</a>(sys.slot);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    }</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a312615f5bd64cedf703c19e61e3e561a">   68</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> *<a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a312615f5bd64cedf703c19e61e3e561a" title="Return the AssetGroup referenced by this node.">group</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><a class="code" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a>*<span class="keyword">&gt;</span>(sys.pGroup);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    }</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a51dd3414b0bc5cfcb9e293aa7c893e9e">   75</a></span>&#160;    _SYSVolumeHandle <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a51dd3414b0bc5cfcb9e293aa7c893e9e" title="Return the Volume handle referenced by this node.">volume</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="keywordflow">return</span> sys.volume;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    }</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#acb2790bf25114b747297affce8cab728">   82</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#acb2790bf25114b747297affce8cab728" title="Get the size of this asset group, in tiles.">numTiles</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <span class="keywordflow">return</span> sys.numTiles;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a5fc950abce732373e4e0428e401373f9">   91</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#a5fc950abce732373e4e0428e401373f9" title="How many tiles will this group use up in its AssetSlot?">tileAllocation</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keywordflow">return</span> roundup&lt;unsigned&gt;(<a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#acb2790bf25114b747297affce8cab728" title="Get the size of this asset group, in tiles.">numTiles</a>(), _SYS_ASSET_GROUP_SIZE_UNIT);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#adebafd4eca40fe03983ab99d2b4fc9cc">   98</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_asset_configuration_node.html#adebafd4eca40fe03983ab99d2b4fc9cc" title="Get the compressed size of this asset group, in bytes.">compressedSize</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <span class="keywordflow">return</span> sys.dataSize;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    }</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;};</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="keyword">template</span> &lt;<span class="keywordtype">unsigned</span> tCapacity&gt;</div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_asset_configuration.html">  119</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_asset_configuration.html" title="An AssetConfiguration represents an arrangement of AssetGroups to load.">AssetConfiguration</a> : <span class="keyword">public</span> <a class="code" href="class_sifteo_1_1_array.html" title="A statically sized array.">Array</a>&lt;AssetConfigurationNode, tCapacity, uint8_t&gt; {</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keyword">typedef</span> <a class="code" href="class_sifteo_1_1_array.html">Array&lt;AssetConfigurationNode, tCapacity, uint8_t&gt;</a> <a class="code" href="class_sifteo_1_1_array.html">super</a>;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_asset_configuration.html#aded2e668733f1d331927813244a2c264">  135</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_array.html#a6ff4b20ceee9d4e8e41dde2245769fd9" title="Synonym for push_back()">append</a>(_SYSAssetSlot slot, <a class="code" href="struct_sifteo_1_1_asset_group.html" title="A bundle of compressed tile data, for use by AssetImages.">AssetGroup</a> &amp;group, _SYSVolumeHandle volume = 0)</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    {</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <a class="code" href="class_sifteo_1_1_array.html#a6ff4b20ceee9d4e8e41dde2245769fd9" title="Synonym for push_back()">super::append</a>().init(slot, group, volume);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    }</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;};</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html">  209</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_asset_loader.html" title="An AssetLoader coordinates asset loading operations on one or more cubes.">AssetLoader</a> {</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    _SYSAssetLoader sys;</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    _SYSAssetLoaderCube cubes[<a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>];</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;</div>
<div class="line"><a name="l00214"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#ab7347988a1d72ff7ddef19e0074a45f1">  214</a></span>&#160;    <span class="keyword">operator</span> <span class="keyword">const</span> _SYSAssetLoader&amp; () <span class="keyword">const</span> { <span class="keywordflow">return</span> sys; }</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <span class="keyword">operator</span> _SYSAssetLoader&amp; () { <span class="keywordflow">return</span> sys; }</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <span class="keyword">operator</span> <span class="keyword">const</span> _SYSAssetLoader* () <span class="keyword">const</span> { <span class="keywordflow">return</span> &amp;sys; }</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <span class="keyword">operator</span> _SYSAssetLoader* () { <span class="keywordflow">return</span> &amp;sys; }</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#afed2ef66084d236ee30f44ff961eede5">  227</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#afed2ef66084d236ee30f44ff961eede5" title="Initialize this object.">init</a>() {</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;        <a class="code" href="group__memory.html#ga20938d45e7d2889376bd3151c5a1ce44" title="Write &#39;n&#39; zero bytes to memory.">bzero</a>(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    }</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;</div>
<div class="line"><a name="l00240"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a349fbf02cb0acbeca90f25cb47ddf05f">  240</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a349fbf02cb0acbeca90f25cb47ddf05f" title="Ensure that the system is no longer using this AssetLoader object.">finish</a>() {</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;        _SYS_asset_loadFinish(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    }</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div>
<div class="line"><a name="l00261"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a4372641ecdcf784d60c1f9a92b4ef2d1">  261</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a4372641ecdcf784d60c1f9a92b4ef2d1" title="End any in-progress asset loading operations without finishing them.">cancel</a>(_SYSCubeIDVector cubes = -1) {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        _SYS_asset_loadCancel(*<span class="keyword">this</span>, cubes);</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;    }</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;    <span class="keyword">template</span> &lt; <span class="keyword">typename</span> T &gt;</div>
<div class="line"><a name="l00298"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#ab1e40dc5484cb0f363b283d983e9467f">  298</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#ab1e40dc5484cb0f363b283d983e9467f" title="Start installing an AssetConfiguration.">start</a>(T&amp; configuration, _SYSCubeIDVector cubes = -1)</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    {</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;        <span class="comment">// Limit to cubes that we&#39;ve allocated _SYSAssetLoaderCubes for</span></div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;        <a class="code" href="group__macros.html#ga83608df0f7c42773fdb6030debad2f60">STATIC_ASSERT</a>(<a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a> &lt;= _SYS_NUM_CUBE_SLOTS);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        cubes &amp;= 0xFFFFFFFF &lt;&lt; (32 - <a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>);</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;        _SYS_asset_loadStart(*<span class="keyword">this</span>, &amp;configuration.begin()-&gt;sys, configuration.count(), cubes);</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    }</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;</div>
<div class="line"><a name="l00318"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a41d98f45a91f5336d52c7d062c9a31d3">  318</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a41d98f45a91f5336d52c7d062c9a31d3" title="Measures progress on a single cube, as an integer.">cubeProgress</a>(_SYSCubeID cubeID, <span class="keywordtype">unsigned</span> max)<span class="keyword"> const</span></div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(cubeID &lt; <a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>);</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <span class="comment">// NB: Division by zero on ARM (udiv) yields zero.</span></div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;        <span class="keywordflow">return</span> cubes[cubeID].progress * max / cubes[cubeID].total;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    }</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;</div>
<div class="line"><a name="l00333"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a054be6b34ccf69c5241bf60798224048">  333</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a41d98f45a91f5336d52c7d062c9a31d3" title="Measures progress on a single cube, as an integer.">cubeProgress</a>(_SYSCubeID cubeID)<span class="keyword"> const</span></div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(cubeID &lt; <a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>);</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keywordtype">unsigned</span> progress = cubes[cubeID].progress;</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;        <span class="keywordtype">unsigned</span> total = cubes[cubeID].total;</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;        <span class="keywordflow">return</span> total ? (progress / float(total)) : 0.0f;</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;    }</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div>
<div class="line"><a name="l00353"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#af927e1d9a6262e065aeecf4e70583523">  353</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#ab16b393889cc5e90e923ff5bd09b3c99" title="Measures total progress on all cubes, as a floating point value.">averageProgress</a>(<span class="keywordtype">unsigned</span> max)<span class="keyword"> const</span></div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;        <span class="keywordtype">unsigned</span> progress = 0, total = 0;</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; <a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>; ++i) {</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;            progress += cubes[i].progress;</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;            total += cubes[i].total;</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;        }</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        <span class="keywordflow">return</span> progress * max / total;</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    }</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;</div>
<div class="line"><a name="l00371"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#ab16b393889cc5e90e923ff5bd09b3c99">  371</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#ab16b393889cc5e90e923ff5bd09b3c99" title="Measures total progress on all cubes, as a floating point value.">averageProgress</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;<span class="keyword">    </span>{</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;        <span class="keywordtype">unsigned</span> progress = 0, total = 0;</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; <a class="code" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57" title="Compile-time cube limit for the current application.">CUBE_ALLOCATION</a>; ++i) {</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;            progress += cubes[i].progress;</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;            total += cubes[i].total;</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;        }</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        <span class="keywordflow">return</span> total ? (progress / float(total)) : 0.0f;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    }</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;</div>
<div class="line"><a name="l00384"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a966718ecff9ee023aaf1228a82984965">  384</a></span>&#160;    _SYSCubeIDVector <a class="code" href="struct_sifteo_1_1_asset_loader.html#a966718ecff9ee023aaf1228a82984965" title="Which cubes are still busy loading?">busyCubes</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        <span class="keywordflow">return</span> sys.busyCubes;</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;    }</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;</div>
<div class="line"><a name="l00399"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#ae4b462cf20b7c5b24bb273a8bc6a59d0">  399</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#ae4b462cf20b7c5b24bb273a8bc6a59d0" title="Is the asset install finished for all cubes in the specified vector?">isComplete</a>(_SYSCubeIDVector <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;        <span class="keywordflow">return</span> (sys.busyCubes &amp; vec) == 0;</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;    }</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    </div>
<div class="line"><a name="l00408"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a9013f054ed031bffb47b634b3bbe34a6">  408</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a9013f054ed031bffb47b634b3bbe34a6" title="Is the asset install for &quot;cubeID&quot; finished?">isComplete</a>(_SYSCubeID cubeID)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a507c2d0a96392489997209862c3113ce" title="Are all asset installations from this asset loading session complete?">isComplete</a>(_SYSCubeIDVector(0x80000000 &gt;&gt; cubeID));</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    }</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;</div>
<div class="line"><a name="l00415"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_asset_loader.html#a507c2d0a96392489997209862c3113ce">  415</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html#a507c2d0a96392489997209862c3113ce" title="Are all asset installations from this asset loading session complete?">isComplete</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;        <span class="keywordflow">return</span> sys.busyCubes == 0;</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;    }</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;};</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;</div>
<div class="line"><a name="l00430"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_scoped_asset_loader.html">  430</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_scoped_asset_loader.html" title="An AssetLoader subclass which automatically calls init() and finish() in the constructor and destruct...">ScopedAssetLoader</a> : <span class="keyword">public</span> <a class="code" href="struct_sifteo_1_1_asset_loader.html" title="An AssetLoader coordinates asset loading operations on one or more cubes.">AssetLoader</a> {</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;    <a class="code" href="class_sifteo_1_1_scoped_asset_loader.html" title="An AssetLoader subclass which automatically calls init() and finish() in the constructor and destruct...">ScopedAssetLoader</a>() { <a class="code" href="struct_sifteo_1_1_asset_loader.html#afed2ef66084d236ee30f44ff961eede5" title="Initialize this object.">init</a>(); }</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;    ~<a class="code" href="class_sifteo_1_1_scoped_asset_loader.html" title="An AssetLoader subclass which automatically calls init() and finish() in the constructor and destruct...">ScopedAssetLoader</a>() { <a class="code" href="struct_sifteo_1_1_asset_loader.html#a349fbf02cb0acbeca90f25cb47ddf05f" title="Ensure that the system is no longer using this AssetLoader object.">finish</a>(); }</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;};</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;};  <span class="comment">// namespace Sifteo</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
